package cn.hp.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.hp.domain.Role;
import cn.hp.mapper.RoleMapper;
import cn.hp.service.RoleService;
@Service
@Transactional
public class RoleServiceImpl implements RoleService{
	
	@Autowired
	private RoleMapper roleMapper;
	
	@Override
	public List<String> findRolesByUserId(Integer userid) {
		List<Role> roles=roleMapper.findRolesByUserId(userid);
		List<String> roleList=new ArrayList<>();
		for (Role role : roles) {
			roleList.add(role.getRolename());
		}
		return roleList;
	}

}
